package common;

import org.testng.IRetryAnalyzer;
import org.testng.ITestResult;

public class Retry implements IRetryAnalyzer
{
	private int retryCount = 0;
	private int maxRetryCount = 10; // retry a failed test 10 additional times

	@Override
	public boolean retry(ITestResult result)
	{
		if (retryCount < maxRetryCount)
		{
			String message = "running retry for '" + result.getName() +  
					" Retrying " + (retryCount+1);
			
			System.out.println(message);//2017/10/18 gaowen - 控制台打印失败次数
			retryCount++;
			return true;
		}
		retryCount=0;
		return false;
	}
}